namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0048 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.IcmDisposeOfficeSupplylotHistory",
                c => new
                    {
                        DisposeOfficeSupplylotHisId = c.Int(nullable: false, identity: true),
                        OfficeSuppliesLotId = c.Int(nullable: false),
                        DisposeId = c.Int(nullable: false),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DisposeOfficeSupplylotHisId)
                .ForeignKey("dbo.IcmDispose", t => t.DisposeId, cascadeDelete: true)
                .ForeignKey("dbo.IcmOfficeSuppliesLot", t => t.OfficeSuppliesLotId, cascadeDelete: true)
                .Index(t => t.DisposeId)
                .Index(t => t.OfficeSuppliesLotId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.IcmDisposeOfficeSupplylotHistory", new[] { "OfficeSuppliesLotId" });
            DropIndex("dbo.IcmDisposeOfficeSupplylotHistory", new[] { "DisposeId" });
            DropForeignKey("dbo.IcmDisposeOfficeSupplylotHistory", "OfficeSuppliesLotId", "dbo.IcmOfficeSuppliesLot");
            DropForeignKey("dbo.IcmDisposeOfficeSupplylotHistory", "DisposeId", "dbo.IcmDispose");
            DropTable("dbo.IcmDisposeOfficeSupplylotHistory");
        }
    }
}
